package com.xx.service.impl;

import com.xx.dao.DeletePermissionMapper;
import com.xx.dao.FindPermissionMapper;
import com.xx.dao.InsertPermissionMapper;
import com.xx.domain.Permission;
import com.xx.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author : 徐闯 ssm_admin
 * @Date : 2021-05-18 14:05:28
 * @Description : 资源权限的业务逻辑
 **/
@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private FindPermissionMapper findPermissionMapper;
    @Autowired
    private DeletePermissionMapper deletePermissionMapper;
    @Autowired
    private InsertPermissionMapper insertPermissionMapper;
    @Override
    public List<Permission> fundAll() {
        return findPermissionMapper.findALl();
    }

    @Override
    @Transactional
    public int deleteOne(int pId) {
        return deletePermissionMapper.deleteOne(pId);
    }

    @Override
    @Transactional
    public int deleteALl(int pIds[]) {
        return deletePermissionMapper.deleteALl(pIds);
    }

    @Override
    @Transactional
    public int insertOne(Permission permission) {
        return insertPermissionMapper.insertOne(permission);
    }
}
